{include file="common/_header-css"}
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">评分管理</a>
            <a>
              <cite>周期管理</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                </div>
                <div class="layui-card-header">
                    <button class="layui-btn" onclick="xadmin.open('添加周期','{:url(\'cycle_add\')}',600,400)"><i class="layui-icon"></i>添加</button>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>周期开始时间</th>
                            <th>周期结束时间</th>
                            <th>描述</th>
                            <th>状态</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                        {volist name='list' id='vo'}
                        <tr>
                            <td>{:date('Y-m-d',$vo.start_date)}</td>
                            <td>{:date('Y-m-d',$vo.stop_date)}</td>
                            <td>{$vo.describe}</td>
                            <td class="td-status">
                                {if $vo.start_date < time() && $vo.stop_date > time()}
                                <span class="layui-btn layui-btn-normal layui-btn-mini">已启用</span>
                                {else /}
                                <span class="layui-btn layui-btn-disabled layui-btn-mini">未启用</span>
                                {/if}
                            </td>
                            <td class="td-manage">
                                <a title="删除" onclick="deleteLevel(this,'{$vo.id}')" href="javascript:;">
                                    <i class="layui-icon">&#xe640;</i>
                                </a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        <div>
                            {$list|raw}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });
    function deleteLevel(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.post('{:url(\'integral/cycle_del\')}',{id:id},function (res) {
                if (res.code == 200) {
                    $(obj).parents("tr").remove();
                    layer.msg(res.msg,{icon:1,time:1000});
                }else{
                    layer.msg(res.msg,{icon:5,time:500});
                }
            });
        });
    }
</script>


</html>